#!/bin/bash
project_pid=$(netstat -lnp | grep 7104|awk '{print $7}'|cut -d/ -f1)
echo $project_pid
if [ $project_pid > 0 ];
then
   docker stop renrenmessage \
      && docker rm renrenmessage \
      && docker rmi renrenmessage:1.0 \
      && docker build -f dockerfile -t renrenmessage:1.0 . \
      && docker run -p 7104:7104 -v /data/service/RenrenMessage/config:/app/config -v /data/service/RenrenMessage/logs:/app/logs --name renrenmessage -d --privileged --restart always --network dlrs-net renrenmessage:1.0
else
   docker build -f dockerfile -t renrenmessage:1.0 . \
      && docker run -p 7104:7104 -v /data/service/RenrenMessage/config:/app/config -v /data/service/RenrenMessage/logs:/app/logs --name renrenmessage -d --privileged --restart always --network dlrs-net renrenmessage:1.0
fi

